import QtQuick
import QtQuick.Particles

Window {
    id: root
    width: 640
    height: 480
    visible: true
    color: "transparent"
    flags: Qt.Window | Qt.FramelessWindowHint | Qt.WindowSystemMenuHint | Qt.WindowMinMaxButtonsHint

    property color mBackColor: "#34393e"
    property color mTextColor: "#e1e4e8"

    CustomHeaderBarClose {
        id: headerBar
        width: parent.width
        height: 34
        chbTitleText: qsTr("使用说明")

        onClosePageBtnClicked: {
            root.close()
        }

        onWinPositionChanged: function(x, y) {
            root.setX(root.x + x)
            root.setY(root.y + y)
        }
    }

    Rectangle {
        width: parent.width
        anchors.top: headerBar.bottom
        anchors.bottom: parent.bottom
        color: mBackColor

        Column {
            anchors.centerIn: parent
            spacing: 5

            Repeater {
                model: ["1. 左侧边栏选择并连接设备",
                    "2. 建议先读取设备过滤配置",
                    "3. 再根据需求进行相应修改",
                    "4. 共一百组过滤设置，滑动查看更多",
                    "5. 使能表示该组设置参与过滤，失能反之",
                ]
                delegate: AsText {
                    width: 250
                    text: modelData
                    color: mTextColor
                    font.pixelSize: 15
                    font.italic: true
                    horizontalAlignment: Text.AlignLeft
                }
            }
        }

        MouseArea {
            anchors.fill: parent

            onPressed: {
                emitter.x = mouseX
                emitter.y = mouseY + headerBar.height - emitter.height
                emitter.enabled = true
            }

            onReleased: {
                emitter.enabled = false
            }

            onPositionChanged: function(mouse) {
                emitter.x = mouse.x
                emitter.y = mouse.y + headerBar.height - emitter.height
            }
        }
    }

    ParticleSystem {
        id: particleSystem
    }

    ImageParticle {
        id: lovePainter
        source: "qrc:/imgs/love.png"
        system: particleSystem
    }

    Emitter {
        id: emitter
        x: 0
        y: 0
        width: 10
        height: 10
        system: particleSystem
        enabled: false
        emitRate: 20

        lifeSpan: 1000
        lifeSpanVariation: 400

        size: 14
        endSize: 24
        sizeVariation: 5
    }

}
